import React from "react";
import { Author } from "../types";

interface AuthorPropsType {
  isAnonymous: boolean;
}

const AuthorList: React.FC<AuthorPropsType> = (
  authorProps: AuthorPropsType,
) => {
  const authorInfoList: Author[] = [
    { name: "Anonymous ACL submission", dept: "" },
    // { name: "Qian Tao", dept: "South China University of Technology" },
    // { name: "Songbo Wang", dept: "South China University of Technology" },
    // { name: "Chenghao Liu", dept: "South China University of Technology" },
    // { name: "Lusi Li", dept: "Old Dominion University" },
  ];
  const uniqueDepts = Array.from(
    new Set(authorInfoList.map((author) => author.dept)),
  ); // 获取唯一的dept
  if (!authorProps.isAnonymous)
    return (
      <div>
        <div>
          <div style={{ marginRight: "20px" }}>
            {/*<h3>Names</h3>*/}
            {authorInfoList.map((author, index) => (
              <div key={index} style={{ display: "inline-block" }}>
                {author.name}
                {Array(uniqueDepts.indexOf(author.dept) + 1)
                  .fill("*")
                  .join("")}
                {"    "} &emsp;&emsp;
              </div>
            ))}
          </div>
          <div>
            {uniqueDepts.map((dept, index) => (
              <div key={index} style={{ display: "inline-block" }}>
                <h6>
                  {dept}
                  {Array(index + 1)
                    .fill("*")
                    .join("")}{" "}
                  &emsp;&emsp;
                </h6>
              </div>
            ))}
          </div>
        </div>
      </div>
    );
  else
    return (
      <div style={{ marginRight: "20px" }}>
        {authorInfoList.map((author, index) => (
          <div key={index} style={{ display: "inline-block" }}>
            {author.name}
            {"    "} &emsp;&emsp;
          </div>
        ))}
      </div>
    );
};

export default AuthorList;
